# a="Https://Mail.163.com"

# a="sassadASDA"
# b=a.upper()
# c=a.lower()
# print(b)
# print(c)

# chars=['a','c','a','v','b','a','c']
# acount={}
# for s in chars:
#     acount[s]=chars.count(s)
# # for i in chars:
# #     if i in acount:
# #         acount[i]+=1
# #     else:
# #         acount[i]=1
# print(acount)

persons=[
    {"name":"Tom","age":18},
    {"name":"lisa","age":15},
    {"name":"Sufv","age":20},
    {"name":"Linda","age":13}
]
# name=input("请输入一个姓名：")
# for person in persons:
#     if person["name"]==name:
#         print("该用户已经存在")
#         break
# else:
#         age=input("请输入年龄")
#         newp={"name":name,"age":age}
#         persons.append(newp)
# print(persons)


# dict1={'a':100,'b':200,'c':300}
# dict2={v:k for k,v in dict1.items()}
# print(dict2)

students=[
    {'name':'张三','age':18,'score':98,'tel':'13888889999','gender':'男'},
    {'name':'李四','age':28,'score':95,'tel':'13888886666','gender':'女'},
    {'name':'王五','age':21,'score':98,'tel':'138888897777','gender':'不明'},
    {'name':'chris','age':17,'score':58,'tel':'13888884448','gender':'男'},
    {'name':'jack','age':23,'score':52,'tel':'13888881111','gender':'女'},
    {'name':'tony','age':15,'score':89,'tel':'13888882222','gender':'不明'},
]
bjg=0
for bj in students:
    if bj['score']<60:
     bjg+=1
     print(bj['name'],bj['score'])
     print(bj)
print(bjg)
# 打印不及格学生的名字和对应的成绩
for x in students:  # 用x对列表循环
    if x['score'] < 60:
        print(x['name'], x['score'])   #得分小于60 输出姓名和成绩
# 统计未成年学生的个数
count2 = 0    # 令初始个数为1
for x in students:   # 用x对列表循环
    if x['age'] < 18:
        count2 += 1    #年龄小于18 计数
print(count2)     #打印输出
# 打印手机尾号是8的学生的名字
for x in students:    # 用x对列表循环
    if int(x['tel']) % 10 == 8:     #电话号码对10取余，如果是8，即尾号
        print(x['name'])   #打印输出学生姓名
# 打印最高分和对应的学生的名字
max1 = 0     #默认最高分为0
list2 = []     #定义存储学生成绩空列表
for x in students:      # 用x对列表循环
    list2.append(x['score'])      #先把所有学生成绩放在一个列表中
for y in list2:
    if y > max1:
        max1 = y      #遍历列表，找到最高分
for z in students:    # 用z对列表循环
    if z['score'] == max1:
        print(z['name'], max1)     #找到最高分对应学生的姓名
# 删除性别不明的所有学生
for x in students:   # 用x对列表循环
    if x['gender'] == 'unknown':    #找到性别未知的学生
        x.clear()   #调用clear()删去
for y in students:   # 用x对列表循环
    print(y)       #打印已更新的列表